package mo.golden;

public class L01_03 {

    public String replaceSpaces(String S, int length) {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < length; i++) {
            if (S.charAt(i) != ' ') {
                builder.append(S.charAt(i));
            } else {
                builder.append("%20");
            }
        }
        return builder.toString();
    }

}
